<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/website/common/base.jsp"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的退货订单</title>
<%@ include file="/website/common/common.jsp"%>
<link href="${webctx }/css/manage.css" rel="stylesheet" type="text/css" />
<link href="${webctx }/css/order.css" rel="stylesheet" type="text/css" />
</head>

<body>
<%@ include file="/website/common/top.jsp"%>
<%@ include file="/website/common/head.jsp"%>
<%@ include file="/website/common/menu.jsp"%>

<div class="warp-body">
	<div class="inner clearfix">
    	<div class="left-main">
        	<div class="left-inner">
            	<%@ include file="/website/user/left.jsp"%>
            </div>
        </div>
    	<div class="right-main">
        	<div class="right-inner" id="orderlistpanel">
            	<!-- 订单列表 -->
            	<div class="right-title"><span></span>我的退货订单</div>
                <div class="type-th clearfix">
                   	<div class="info th">订单信息</div>
                   	<div class="price th">商品价格</div>
                   	<div class="num th">数量</div>
                   	<div class="money th">订单金额</div>
                   	<div class="state th">订单状态</div>
                   	<div class="op th">操作</div>
                </div>
            	<c:forEach items="${list }" var="order">
                <div class="order-item">
                        <table width="100%" class="order-item-con">
                            <tbody class="item-th">
                                <tr>
                                    <td><span>订单编号${order.code } </span><span>下单时间：${order.order_time }</span></td>
                                    <td></td>
                                    <td colspan="4"></td>                                               
                                </tr>
                            </tbody> 
                           	<tbody class="item-info">
                           		<c:forEach items="${order.productlist }" var="product" varStatus="status">
                           		<tr>
                                	<td>
                                    	<div class="pro-info-con clearfix">
                                        	<div class="pro-pic"><a href="${ctx }/product/info?priceid=${product.id}" target="_blank"><img src="<%=getRandomFileserver()%>${product.photo}" width="95" height="95" alt=""></a></div>
                                            <div class="td-inner">
                                                <div class="info-title">${product.productname } ${product.name }</div>
                                                <ul class="info-txt">
                                                    <li class="clearfix">
                                                        <span class="tl">生产厂家：${product.B_chanjia }</span>
                                                        <span>件装量： ${product.B_zhuanl }</span>
                                                    </li>
                                                    <li class="clearfix">
                                                        <span class="tl">规　　格：${product.B_guige }</span>
                                                        <span>单　位： ${product.unitname }</span>
                                                    </li>
                                                    <li class="clearfix">
                                                        <span class="tl">批准文号：${product.B_pzwh }</span>
                                                        <span>可拆零： ${product.B_kechai }</span>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </td>
                                	<td style="vertical-align:top;padding-top:45px;">
                                        <div class="td-price td">
                                            <p>￥${product.buyprice }</p>
                                        </div>
                                    </td>
                                	<td style="vertical-align:top;padding-top:45px;">
                                    	<div class="td-num td"><p>×${product.buyamount }</p></div>
                                    </td>
                                    <c:if test="${status.count==1}">
                                	<td rowspan="${order.productlist.size() }" style="vertical-align:top;padding-top:45px;">
                                    	<div class="td-money td"><p >￥${order.countmoney }</p></div>
                                    </td>
                                	<td rowspan="${order.productlist.size() }" style="vertical-align:top;padding-top:45px;">
                                    	<div class="td-state td">                    
                                            <p>
                                            	<c:choose>
													<c:when test="${order.backtag==1}">待审核</c:when>
													<c:when test="${order.backtag==2}">同意退货</c:when>
													<c:when test="${order.backtag==3}">拒绝退货</c:when>
													<c:when test="${order.backtag==4}">退货取消</c:when>
													<c:when test="${order.backtag==5}">退货完成</c:when>
												</c:choose>
											</p>
                                        </div>
                                    </td>
                                	<td rowspan="${order.productlist.size() }" style="vertical-align:top">
                                    	<div class="td-op td" <c:if test="${order.productlist.size()>1}">style="padding-top:40px;"</c:if>>
                                        	<p><a href="javascript:showinfo('${order.id }');">查看订单</a></p>
		                                	 <c:choose>
		                                	 <c:when test="${order.backtag==1 || order.backtag==2 || order.backtag==3}">
		                                	 	<p><a href="javascript:cancelorder('${order.id }');">取消退货</a></p>
		                                	 </c:when>
		                                	 </c:choose>
                                        </div> 
                                    </td>
                                    </c:if>
                                </tr>
                                </c:forEach>
                           	</tbody>   
                        </table> 


                  </div>    
            	</c:forEach>
            	${pagehtml }
            	<!-- 订单列表结束 -->
            </div>
            <div class="right-inner hide" id="orderinfopanel">
            	<!-- 订单详情 -->
            	<div style="text-align:center;margin:20px;">正在加载订单详情...</div>
            	<!-- 订单详情结束 -->
            </div>
        </div>
    </div>
</div>

<%@ include file="/website/common/foot.jsp"%>
<link type="text/css" rel="stylesheet" href="${webctx }/css/webeasyui.css">
<script type="text/javascript" src="${ctx }/util/js/easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx }/util/js/easyui-1.3.3/locale/easyui-lang-zh_CN.js" charset="utf-8"></script>
</body>
</html>
<script>
$(function(){
	setLeftCur("backorderlist");
})
function query(){
	
}
function showinfo(orderid){
	$("#orderlistpanel").addClass("hide");
	$("#orderinfopanel").removeClass("hide");
	$(window).scrollTop(80);
	$w.loadPanel(ctx+"/order/backorderinfo",{"orderid":orderid},"orderinfopanel");
}
function cancelorder(orderid){
	if(confirm("确定取消退货？")){
		$w.httpRequest({
			url:apiroot+"/order/cancelbackorder",
			data:{"orderid":orderid},
			ok:function(ret){
				window.location.reload();
			}
		})
	}
}
function hideorderinfo(){
	$("#orderinfopanel").addClass("hide");
	$("#orderlistpanel").removeClass("hide");
}
</script>